﻿using System;
using System.Linq;
using System.Collections.Generic;
using System.Text;
using WoChu.RfClient.Duty;
using WoChu.RfClient.Entity;

namespace WoChu.RfClient.Duty
{
    public class OffShelvesUIRule
    {
        private static OffShelvesUIRule _NewInstance = new OffShelvesUIRule();

        public static OffShelvesUIRule NewInstance
        {
            get
            {
                if (_NewInstance == null)
                {
                    _NewInstance = new OffShelvesUIRule();
                }

                return _NewInstance;
            }
        }

      
        public ResultModel<LocationGoodsInfo> GetLocationGoodsInfo(string gbCode)
        {
            try
            {
                var _result = WoChu.CF.BaseFrame.WebClient.WebGetHelper<IOffShelves>.NewInstance.InvokeWebMethod<ResultModel<LocationGoodsInfo>>("GetLocationGoodsInfo", new object[] { gbCode });
                if (_result == null)
                    return new ResultModel<LocationGoodsInfo>().GetInstance();
                return _result;
            }
            catch (Exception ex)
            {
                WoChu.CF.BaseFrame.Util.MessageBoxEx.Show(ex);
                return new ResultModel<LocationGoodsInfo>().GetInstance();
            }
            
        }

        public ResultModel<bool> SetOffShelves(string userID,string objType, List<LocationGoodsInfo> lstLocationGoods)
        {
            try
            {
                ResultModel<bool> _result = WoChu.CF.BaseFrame.WebClient.WebGetHelper<IOffShelves>.NewInstance.InvokeWebMethod<List<LocationGoodsInfo>, ResultModel<bool>>("SetOffShelves", new object[] { userID, objType }, lstLocationGoods);
                if (_result == null)
                    return new ResultModel<bool>().GetInstance();
                return _result;
            }
            catch (Exception ex)
            {
                WoChu.CF.BaseFrame.Util.MessageBoxEx.Show(ex);
                return new ResultModel<bool>().GetInstance();
            }
        }

        public ResultModel<List<LocationGoodsInfo>> CheckGetLocationGoodsInfo(string gbCode)
        {
            try
            {
                var _result = WoChu.CF.BaseFrame.WebClient.WebGetHelper<IOffShelves>.NewInstance.InvokeWebMethod<ResultModel<List<LocationGoodsInfo>>>("CheckGetLocationGoodsInfo", new object[] { gbCode });
                if (_result == null)
                    return new ResultModel<List<LocationGoodsInfo>>().GetInstance();
                return _result;
            }
            catch (Exception ex)
            {
                WoChu.CF.BaseFrame.Util.MessageBoxEx.Show(ex);
                return new ResultModel<List<LocationGoodsInfo>>().GetInstance();
            }

        }

        public ResultModel<int> SetInvTipnumber(string gbCode)
        {
            try
            {
                var _result = WoChu.CF.BaseFrame.WebClient.WebGetHelper<IOffShelves>.NewInstance.InvokeWebMethod<ResultModel<int>>("SetInvStatusTip", new object[] { gbCode });
                if (_result == null)
                    return new ResultModel<int>().GetInstance();
                return _result;  
            }
            catch (Exception ex)
            {
                WoChu.CF.BaseFrame.Util.MessageBoxEx.Show(ex);
                return new ResultModel<int>().GetInstance();
            }
        }

    }
}
